﻿using Abp.Dependency;
using Abp.Domain.Entities;
using Abp.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;

namespace AbpProjectTemplate.EntityFrameworkCore
{
    public class AppDbContextEntityFinder : IDbContextEntityFinder, ITransientDependency
    {
        public IEnumerable<EntityTypeInfo> GetEntityTypeInfos(Type dbContextType)
        {
            return typeof(AppCoreModule).Assembly.GetTypes()
                .Where(t => typeof(IEntity<>).IsAssignableFrom(t))
                .Select(t => new EntityTypeInfo(t, dbContextType));
        }
    }
}

